﻿namespace RabbitMQExtension
{
    /// <summary>
    /// MQConfig
    /// RabbitMQ配置文件类。
    /// 
    /// 修改纪录
    /// 
    ///		2020.03.23 版本：1.0 Sunnyfish 创建文件。
    /// 
    /// 版本：1.0
    /// 
    /// <author>
    ///		<name>Sunnyfish</name>
    ///		<date>2020.03.23</date>
    /// </author> 
    /// </summary>
    public class MQConfig
    {
        /// <summary>
        /// 主机地址, 多个地址用英文","分割，多个域名时，请保证 端口号一致 例如 192.168.0.1:5672,192.168.0.2:5673
        /// </summary>
        public string Host { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }

        /// <summary>
        /// 虚拟主机名
        /// </summary>
        public string VirtualHost { get; set; } = "/";

        public int MaxComsumerThreads { get; set; } = 1;

        public MQConfig(string host, string userName, string password, string virtualHost = "/", int maxThread = 4)
        {
            Host = host;
            UserName = userName;
            Password = password;
            VirtualHost = string.IsNullOrEmpty(virtualHost) ? "/" : virtualHost;
            MaxComsumerThreads = maxThread;
        }
        public MQConfig()
        {
        }

        public override string ToString()
        {
            return $"Host:{Host},VirtualHost:{VirtualHost}";
        }
    }
}
